<template>
    <a-card :bordered="false">
      <div class="table-operator">
          <a-button shape="round" size="small" type="primary" icon="plus" @click="handleEdit({},'serviceQForm','新增')">新增</a-button>
      </div>
        <LTable
        ref="serviceQaList"
        size="middle"
        :rowKey="record=>record.keyId"
        :formAttributes="formAttributes"
        :columns="columns"
        axiosUrl="/KhyServiceQaController/page"
        :showPagination="true"
        :showQueryForm="true"
        :initOrder="[{field:'questionOrder',val:'asc'}]"
      >
      <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'serviceQForm',record.serviceQaListTitle)">查看</a>
          <a-divider type="vertical" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete({keyId:record.keyId},'/KhyServiceQaController/del','serviceQaList')">
                <a>删除</a>
            </a-popconfirm>
      </span>
    </LTable>
      <serviceQForm ref="serviceQForm" @close="refresh('serviceQaList')" @ok="refresh('serviceQaList')"></serviceQForm> 
    </a-card>
</template>

<script>
import LTable from '@/components/lt/LTable'
import {SysMixin} from '@/mixins/SysMixin'
import defaultSettings from '@/config/defaultSettings'
import serviceQForm from './serviceQaForm'

export default {
    name:'serviceQaList',
    components:{
       LTable,
       serviceQForm
    },
    mixins:[SysMixin],
    data(){
        return{
            initDictCodes:"defaultSettings.数据字典.是否",
            defaultSettings,
            formAttributes:[
               {field:'questionTitle',label:'客服问题',component:'input',condition:'like'},
                {field:'isUse',label:'是否可用',component:'select',condition:'eq',dictCode:defaultSettings.数据字典.是否},
            ],
            columns:[
                {
                  
                    title: '序号',
                    dataIndex: '',
                    key:'rowIndex',
                    width:60,
                    align:"center",
                    customRender:function (t,r,index) {
                      return parseInt(index)+1;
                    }
                },
               
                {
                    title: '客服问题',
                    dataIndex: 'questionTitle'
                },
                 {
                    title: '是否可用',
                    dataIndex: 'isUse',
                    customRender:(text)=>{
                       if(!text){
                            return ''
                        }else{
                            return this.dictText(defaultSettings.数据字典.是否,text)
                        }
                    }
                },  
                {
                    title: '排序',
                    dataIndex: 'questionOrder'
                }, 
                {
                    title: '创建时间',
                    dataIndex: 'createTime'
                },  
                {
                    title: '操作',
                    dataIndex: 'action',
                    width: '150px',
                    scopedSlots: { customRender: 'action' }
                }
            ],
        
        }
    },
    created(){
       
    },
    methods:{
      
    }
}
</script>